package controllers;

import swings.buttons.TabButton;
import utils.ImageUtils;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * @version V1.0
 * @Title: 按钮组件处理类
 * @Package
 * @Description: 给tab按钮组件添加hover效果
 * @author: GaleBlade
 * @date:
 */
public class TabButtonControl extends MouseAdapter {

	private TabButton btn;

	public TabButtonControl(TabButton btn) {

		this.btn = btn;

	}

	@Override
	public void mouseClicked(MouseEvent e) {
	}

	/**
	 * 鼠标移进按钮时，更换按钮背景图片
	 */
	@Override
	public void mouseEntered(MouseEvent e) {
		if (this.btn.getStatus() == 0){
			this.btn.setIcon(ImageUtils.tab);
		}
	}

	/**
	 * 鼠标移出按钮时，更换按钮背景图片
	 */
	@Override
	public void mouseExited(MouseEvent e) {
		if (this.btn.getStatus() == 0){
			this.btn.setIcon(ImageUtils.label);
		}
	}

	@Override
	public void mouseDragged(MouseEvent e) {
//		System.out.println("mouseDragged");
	}

	@Override
	public void mouseMoved(MouseEvent e) {
	}

	@Override
	public void mousePressed(MouseEvent e) {
	}

	@Override
	public void mouseReleased(MouseEvent e) {
	}
}
